//
//  Created by  fred on 2017/1/12.
//  Copyright © 2016年 Alibaba. All rights reserved.
//

package com.aliyun.getway;
import com.alibaba.cloudapi.sdk.client.ApacheHttpClient;
import com.alibaba.cloudapi.sdk.enums.Scheme;
import com.alibaba.cloudapi.sdk.enums.HttpMethod;
import com.alibaba.cloudapi.sdk.model.ApiRequest;
import com.alibaba.cloudapi.sdk.model.ApiCallback;
import com.alibaba.cloudapi.sdk.model.HttpClientBuilderParams;
import com.alibaba.cloudapi.sdk.enums.ParamPosition;
import com.alibaba.cloudapi.sdk.enums.WebSocketApiType;




public class HttpApiClient_private_demo extends ApacheHttpClient{
    public final static String HOST = "fd1f4fc77bfd452aafa48def541b65b5-cn-beijing.alicloudapi.com";
    static HttpApiClient_private_demo instance = new HttpApiClient_private_demo();
    public static HttpApiClient_private_demo getInstance(){return instance;}

    public void init(HttpClientBuilderParams httpClientBuilderParams){
        httpClientBuilderParams.setScheme(Scheme.HTTP);
        httpClientBuilderParams.setHost(HOST);
        super.init(httpClientBuilderParams);
    }




    public void hsf_flightDelay(String flightNumber , ApiCallback callback) {
        String path = "/hsf-flightDelay/[flightNumber]";
        ApiRequest request = new ApiRequest(HttpMethod.GET , path);
        request.addParam("flightNumber" , flightNumber , ParamPosition.PATH , true);



        sendAsyncRequest(request , callback);
    }
    public void hsf_echo_str(String str , ApiCallback callback) {
        String path = "/hsf-echo/[str]";
        ApiRequest request = new ApiRequest(HttpMethod.GET , path);
        request.addParam("str" , str , ParamPosition.PATH , true);



        sendAsyncRequest(request , callback);
    }
    public void hsf_echo(byte[] body , ApiCallback callback) {
        String path = "/hsf-echo";
        ApiRequest request = new ApiRequest(HttpMethod.POST_BODY , path, body);
        


        sendAsyncRequest(request , callback);
    }
}